<?php
declare(strict_types=1);

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Role extends Model
{
    protected $table = 'system_roles';
    protected $dateFormat = 'U';
    const CREATED_AT = 'create_time';
    const UPDATED_AT = 'update_time';
    const DELETED_AT = 'delete_time';

    public function accounts()
    {
        return $this->hasMany(Account::class, 'role_id', 'id');
    }

    public function menus()
    {
        return $this->belongsToMany(Menu::class, 'system_role_menu', 'role_id', 'menu_id')->using(RoleMenu::class);
    }
}
